<?php
$sql = "SELECT trip.source_label, trip.destination_label, user.name, trip.departTime,
                        trip.via, trip.priceInRupiah, trip.priceInPoint, trip.id as tripId, user.id,
                        trip.status
                from trip,user
                where user.id = trip.userId";
        $query = $this->db->query($sql);
        if ($query->num_rows() > 0) {
            foreach ($query->result() as $value) {
                $a[] = $value;
                echo $a->name;
            }
        } else { 
            echo"error";
        }

?>